package com.day1020;

public class Bullet extends FlySprite implements ActionSprite {
    public Bullet() {
        init();
    }
    public Bullet(int x,int y){
        init();
        this.x = x;
        super.y = y;
    }

    @Override
    public void init() {
        super.image = ImageLoadUtils.load("bullet2.png");
        super.width = image.getWidth() / 2;
        super.height = image.getHeight() / 2;
//        super.x = FlyPanel.hero.x + FlyPanel.hero.width/2 - super.width/2;
//        super.y = FlyPanel.hero.y - super.height;

    }
    @Override
    public void destroy() {
        //移除集合当中越界子弹对象
        FlyPanel.bulletList.remove(this);
    }

    int SPEED = 5;
    /**
     * 子弹向上运行
     */
    @Override
    public void up() {
        super.y = y - SPEED;
        if (super.y < 0){
            this.destroy();
        }

    }

}
